<?php
/**
 * @package constants
 *
 */
/////////////////////////////////////////////////////////////////////
// CONSTANTS

define("BR", "<br />");

/**
 * Set of values which are used in a whole application.
 * The motivation is to be able to easily modify app settings.
 */
class Constants {
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
	/**
	 * CONSTANTS REQUIRED TO CHECK BEFORE APPLICATION IS
	 * STARTED FOR THE FIRST TIME.
	 */
	
	/** database user name */
	const DB_USERNAME = 'eaiis';
	/** database name */
	const DB_DATABASE = 'eaiis';
	/** database password */
	const DB_PASSWORD = 'welcome';
	/** database host */
	const DB_HOST = 'localhost';
	/**
	 * Is used when redirecting clients to this appliaction
	 * Should contain a value which will all users write in the browser
	 * address bar when accessing this application
	 */
	const WEB_DEFAULTPAGE = "http://eaiis.localhost";
	/**
	 * Log file.
	 * Should be writeable by the php interpeter process.
	 */
	const LOG_FILE = "log/eaiis.log";
	/** Logging level */
	const LOG_LEVELDEFAULT = Logger::ERROR_LEVEL;
	
	/** watermark which is used on pictures */
	const IMG_WATERMARK = "watermark2.png";
	
	/** Default count of items in list or thumbnail view */
	const SETUP_COUNTOFITEMSINTHUMVIEW = 8;
	const SETUP_COUNTOFITEMSINLISTVIEW = 20;
	/** available count of offers in list or thumbnail view */
	public static $SETUP_COUNTOFITEMSINLISTVIEW = array(3, 5, 10, 20, 40);
	public static $SETUP_COUNTOFITEMSINTHUMBVIEW = array(4, 8, 12, 24, 48, 96);
	
//////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////	
	
	/** path to certain directories from the top level directory */
	const PATH_IMAGES = "img";
	const PATH_CSS = "style";
	const PATH_INCLUDES = "include";
	const PATH_LOCALIZE = "localization";
	
	/** commonly used database queries */
	const DB_QUERY_USERS_ALL = "select users.* from users";
	const DB_QUERY_OFFERS_ALL = "select offers.* from offers";
	const DB_COMMON_CODESPREFIXFROMAFORM = "c_";
	const DB_CODES_PREFIXLONG = "";
	
	/**
	 * Set filestem directories for images and path delimiter
	 */
	const FS_OFFERS_DIR = "offers";
	const FS_USERS_DIR = "users";
	const FS_DIRDELIMITER = "/";
	
	/**
	 * Desired ratio between height and width of used images
	 */
	const IMG_RATIO = 0.7;
	const IMG_THUMBPREFIX = "ot_";
	const IMG_THUMBMAXSIZE = 100;
	const IMG_FULLPICPREFIX = "of_";
	const IMG_FULLPICMAXSIZE = 500;
	
	const IMG_THUMBPICTHUMBVIEWPREFIX = "tt_";
	const IMG_FULLPICTHUMBVIEWPREFIX = "tf_";
	const IMG_FULLPICTHUMBVIEWMAXSIZE = 153;
	const IMG_THUMBPICTHUMBVIEWMAXSIZE = 15;
	
	/**
	 * Actions desplayed in the url.
	 * It is possible to modify them
	 */
	const REQ_ACTION = "a";
	const REQ_ACTION_REDIRECT = "r";
	const REQ_ACTION_LOGIN = "l";
	const REQ_ACTION_OFFER = "o";
	const REQ_ACTION_THUMBOFFER = "to";
	const REQ_ACTION_REGISTATION = "re";
	const REQ_ACTION_OFFEREDIT = "oe";
	const REQ_ACTION_AJAX = "a";
	const REQ_ACTION_INTERESTEDIN = "ii";
	const REQ_ACTION_SEARCH = "q";
	const REQ_ACTION_USERLIST = "ru";
	const REQ_ACTION_SETTINGS = "sets";
	const REQ_ACTION_ERROR = "error";
	const REQ_ACTION_CONTACT = "contact";
	const REQ_ACTION_ABOUT = "about";
	const REQ_ACTION_SEO = "seo";
	const REQ_ACTION_SITEMAP = "sitemap";
	
	/**
	 * Search parameters identifiers
	 */
	const SEARCH_FULLTEXT = "f";
	const SEARCH_AREATOP = "sat";
	const SEARCH_AREABOTTOM = "sab";
	const SEARCH_PRICETOP = "spt";
	const SEARCH_PRICEBOTTOM = "spb";
	const SEARCH_RENTORSALE = "sros";
	const SEARCH_RENTORSALE_SALE = "sale";
	const SEARCH_RENTORSALE_RENT = "rent";
	
	/**
	 * Type is used as a second parameter if needed when action is called
	 */
	const REQ_TYPE = "t";
	const REQ_TYPE_OFFEREDIT = "oe";
	const REQ_TYPE_LOGIN = "l";
	const REQ_TYPE_REGISTRATION = "r";
	const REQ_TYPE_LOGOUT = "o";
	const REQ_TYPE_SETTINGS = "ts";
	
	/**
	 * Available languages
	 */
	const REQ_LANG = "l";
	const REQ_LANG_EN = "en";
	const REQ_LANG_CS = "cs";
	const REQ_LANG_DE = "de";
	
	/**
	 * Available types of offer's view
	 */
	const REQ_TYPEOFVIEW = "v";
	const REQ_TYPEOFVIEW_THUMB = "t";
	const REQ_TYPEOFVIEW_LIST = "l";
	const REQ_TYPEOFVIEW_ADMIN = "a";
	
	/**
	 * Parameter of a page when paging
	 */
	const REQ_PAGE = "p";
	
	/**
	 * Parameters which affact column sorting
	 */
	const REQ_SORTVAL_LOCALITY = "l";
	const REQ_SORTVAL_TOWN = "t";
	const REQ_SORTVAL_STREET = "s";
	const REQ_SORTVAL_SIZE = "si";
	const REQ_SORTVAL_PRICE = "p";
	const REQ_SORTVAL_AGENT = "ag";
	const REQ_SORTVAL_TOP = "tp";
	const REQ_SORTVAL_STATUS = "sh";
	const REQ_SORTVAL_RENTORSALE = "srs";
	const REQ_SORTVAL = "sv";
	
	const REQ_SORTVAL_LOGIN = "lg";
	const REQ_SORTVAL_GROUP = "g";
	const REQ_SORTVAL_FIRSTNAME = "fn";
	const REQ_SORTVAL_SURNAME = "sn";
	const REQ_SORTVAL_MAIL = "m";
	
	/**
	 * Ascending or descending sort
	 */
	const REQ_SORTTYPE = "s";
	const REQ_SORTTYPE_ASC = "a";
	const REQ_SORTTYPE_DESC = "d";
	
	/**
	 * Default user which has implicitely everybody
	 */
	const WEB_DEFAULTUSER = "anonymous";
	
	/**
	 * WEB_DEFAULTSCRIPT works without mention it. 
	 * Like: "www.google.com/{WEB_DEFAULTSCRIPT}" is the same as "www.google.com/"
	 */ 
	const WEB_DEFAULTSCRIPT = "index.php";
	const PHP_SESSIONVAR = "info";
	
	/**
	 * Identifiers for groups
	 */
	const GROUP_FULL = "full";
	const GROUP_RESTRICTED = "restricted";
	const GROUP_NONE = "none";
	
	public static $SITEMAP_SEARCHKEYWORD = array(
			"kyje", "praha", "rent", "sale");
}
?>